//package ink.tiptop.post;
//
//import com.alibaba.fastjson.JSONObject;
//
//import java.io.UnsupportedEncodingException;
//import java.net.URLEncoder;
//import java.util.Map;
//
///**
// * @author ink.tiptop.zjf
// * @Title: 20200408-v2.1.5
// * @Package ink.tiptop.post
// * @Description:
// * @date 2020-05-29 19:17
// */
//public class PostMain {
//
//    // 私钥解密
//    private static final String PRIVATE_KEY = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANoWlVBLs+pAIvqLoFhH1ceCYxiLH8f6mP874rKqTo4ulknvcixngb+xmd/OU0rR+lTLH3SA5Oarvbwh4tNh8WxDBdRoL1StJF44RiiVRBYnukz2kWQ4rW/8NLDFCA0NUztTY+33z7WZxjDKXEZMb074WC6MC9nT8NRL+y5QZJoNAgMBAAECgYEAgnCLcfE1dOBTi4NDrkmY5bFoz982bQfHxrDs0GvofEYFAcfDhCeMhTkWjbP8QX4BugGbmLUXM5h47TNfVYr5N+pVS7TH+47anHBbiuoKxu42A1HEw6bGjEFHu4SF7isVGPGaFERFfLpaegXnZAM3o7Bvrll8jgbv9hIILw8EYckCQQD7XdApgj/AwPUlAr8M2nj+ulLIuvkrCjj1jIfsAIMOlhAUaTa6USPIac5ttuEij571pcxyY0UAHQ48kusq6JRjAkEA3hu7Sy2pKEanHOczNg8xcgJ8+3USWlyfK2nB+HxwPlQ6wkwDi6UzPNo0+37c9phWayTQNE/a6GZY/lIW0dBKzwJAYnb1O81Ru+faH41b2WUbUG0cUJUtVbbDaSyLcd8hd21BDz3HumReZ/tKaZ/hwPARjJhN5eEM/mZjVUcX588DkQJBAL4b4HkdsR8/MkTEBApugLUEOjQFZdsgUkEXeaaV5IEFGXI7HAHIOg4I+7aURM9xXu7AiNFt1IJ9MAkm/E9ESPMCQAcrN7MGQeL77d5V0UQxjmnByMKmwkvj6GFgNmzHAWCxFPEgfmQjf0iZXIU39//p7dzeC3nvTVlptCrF9JWmpjY=";
//    // 公钥加密
//    private static final String PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDaFpVQS7PqQCL6i6BYR9XHgmMYix/H+pj/O+Kyqk6OLpZJ73IsZ4G/sZnfzlNK0fpUyx90gOTmq728IeLTYfFsQwXUaC9UrSReOEYolUQWJ7pM9pFkOK1v/DSwxQgNDVM7U2Pt98+1mcYwylxGTG9O+FgujAvZ0/DUS/suUGSaDQIDAQAB";
//    // 苏宁给的
////    private static final String PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1msjI0+zS2ut1Hxia405vVBiDoHwl1Ms4TZBK6Pd8o1zrCZcjouIkMi7dwpLqupScw4+TCxXeAkNO93L7gio5FBcuFxLPOz9FxMg9XQ0qwM9moSbhaV8i2vHfOPbxIGrIeJzocnBw/knSFeSUOzxcpP3axTBw1ZE5vUvYDoUjkEs5HKueoCzsT8dyDAgueA1uNnKBpPZwpLzI0JYsmPRM1lSV7qD3NuIkp0/I+7+KfuIfYONqxzn8XqSA6ahq6pUe6eRuqq3FL7aVNQ7m0y9VoYBfdrx4AH8sKBGJKTwjGqdmw3FDEyGgeLTBs6tGXBOd/RFBoqeoeM5ONBRMMmI6QIDAQAB";
//
//    private static final String PARAM_SIGN = "SIGN";
//    private static final String PARAM_OAUTH_TIMESTAMP = "OAUTH_TIMESTAMP";
//
////    public static void main(String[] args) throws Exception {
////
////        Map<String, String> request = getRequest();
////        String waiteToSign = waiteToSignString(request.get(PARAM_OAUTH_TIMESTAMP));
////        System.out.println("待签名字符串:\n" + waiteToSign);
////        String baseString = getBaseString(request.get(PARAM_OAUTH_TIMESTAMP));
////        System.out.println("待签名字符串UrlEncode之后:\n" + baseString);
////        String sign = RSAUtils.getSign(baseString, new OAuthConsumer(null, PRIVATE_KEY));
////        System.out.println("签名后的Sign:\n" + sign);
////
////        String signRequest = "z25IA5I3nw+V+I91Hp9yVg37zBL3dF1GE2LO7K1LefcuZlUfXIXTPy1orth2Ms5M1Pw/9NB5arYE8L5PlmL6fZyruJz/3AJGENm/UvPYIqVL1YP/keTbqmKWO8G20rulDOvJn7H+urJUlZ29Lbx1Czjca6Xybfg3/punrLXMbR8=";
//////
////        String baseString2 = "BIRTHDAY=19900101&IDCARD_TYPE=01&OAUTH_APPID=f0ec96ad2c3848b5b810e7aadf369e2f&OAUTH_APP_VERSION=1.0&OAUTH_METHOD=SHA1&OAUTH_NONCE=549&OAUTH_TIMESTAMP=1590899804&OP_ID=682576&REAL_NAME=01&SEX=1&USER_ID=1234567890123456&USER_TYPE=00";
//////
////        boolean valid = RSAUtils.isValid(signRequest, baseString2, new OAuthConsumer(null, PUBLIC_KEY));
////
////        System.out.println(valid);
//////        encodeTest();
////    }
//
//    private static String waiteToSignString(String time) {
//        String waitToSign = "BIRTHDAY=19900101" +
////                "&IDCARD_NO=HcA9l4sL98gwWpaQbahlHX7XSQYh1fEQLy3QIEc7+ms=" +
//                "&IDCARD_TYPE=01" +
////                "&MOBILE_PHONE=ZSo5QJns28a2VG1xqanGCg==" +
////                "&NAME=y1OEPOATxpa+V9h3KbHY9Q==" +
//                "&OAUTH_APPID=f0ec96ad2c3848b5b810e7aadf369e2f" +
//                "&OAUTH_APP_VERSION=1.0" +
//                "&OAUTH_METHOD=SHA1&OAUTH_NONCE=549" +
//                "&OAUTH_TIMESTAMP=" + time +
//                "&OP_ID=682576" +
////                "&RANDOM=BZ0+6lcEq7Cth2LJqdDmLqFVBZdH+6+FbqrqescJdjlsUMPbeFYcxbUNToSwMozUfgfLKfLFj+KdDVe6JGf60gujih58i1NhsPAa/jsa8Snr10S9alXw8QMj24GTcH5PVILib8INqWzbfMM7sM2qVTn2d7MY+lVKKF864q2Xf+Y=" +
//                "&REAL_NAME=01" +
//                "&SEX=1" +
//                "&USER_ID=1234567890123456" +
//                "&USER_TYPE=00";
//        return waitToSign;
//    }
//
//    private static void encodeTest() {
//        String abc = "+=*~";
//        try {
//            String encode = URLEncoder.encode(abc, "UTF-8");
//            System.out.println(encode);
//        } catch (UnsupportedEncodingException e) {
//            e.printStackTrace();
//        }
//    }
//
//    // +=*~  -> %2B%3D*%7E
//    // +  -> %2B
//    // =  -> %3D
//    // ~  -> %7E
//
//    private static void encodeRequest(Map<String, String> request) {
//        request.forEach((k, v) -> {
//
//        });
//    }
//
//    /**
//     * +  -> %2B
//     * =  -> %3D
//     * ~  -> %7E
//     *
//     * @param timeStamp
//     * @return
//     */
//    private static String getBaseString(String timeStamp) {
//        String waitToSign = "BIRTHDAY=19900101" +
////                "&IDCARD_NO=HcA9l4sL98gwWpaQbahlHX7XSQYh1fEQLy3QIEc7%2Bms%3D" +
//                "&IDCARD_TYPE=01" +
////                "&MOBILE_PHONE=ZSo5QJns28a2VG1xqanGCg%3D%3D" +
////                "&NAME=y1OEPOATxpa%2BV9h3KbHY9Q%3D%3D" +
//                "&OAUTH_APPID=f0ec96ad2c3848b5b810e7aadf369e2f" +
//                "&OAUTH_APP_VERSION=1.0" +
//                "&OAUTH_METHOD=SHA1&OAUTH_NONCE=549" +
//                "&OAUTH_TIMESTAMP=" + timeStamp +
//                "&OP_ID=682576" +
////                "&RANDOM=BZ0+6lcEq7Cth2LJqdDmLqFVBZdH+6+FbqrqescJdjlsUMPbeFYcxbUNToSwMozUfgfLKfLFj+KdDVe6JGf60gujih58i1NhsPAa/jsa8Snr10S9alXw8QMj24GTcH5PVILib8INqWzbfMM7sM2qVTn2d7MY+lVKKF864q2Xf+Y=" +
//                "&REAL_NAME=01" +
//                "&SEX=1" +
//                "&USER_ID=1234567890123456" +
//                "&USER_TYPE=00";
//
//        System.out.println("当前时间:\n" + timeStamp);
//        return waitToSign;
//    }
//
//
//    private static Map<String, String> getRequest() {
//        String jsonString = "{\"OAUTH_APP_VERSION\":\"1.0\",\"OAUTH_NONCE\":\"549\",\"OP_ID\":\"682576\",\"RANDOM\":\"BZ0+6lcEq7Cth2LJqdDmLqFVBZdH+6+FbqrqescJdjlsUMPbeFYcxbUNToSwMozUfgfLKfLFj+KdDVe6JGf60gujih58i1NhsPAa/jsa8Snr10S9alXw8QMj24GTcH5PVILib8INqWzbfMM7sM2qVTn2d7MY+lVKKF864q2Xf+Y=\",\"SEX\":\"1\",\"USER_ID\":\"1234567890123456\",\"OAUTH_TIMESTAMP\":\"1590739650\",\"REAL_NAME\":\"01\",\"NAME\":\"y1OEPOATxpa+V9h3KbHY9Q==\",\"MOBILE_PHONE\":\"ZSo5QJns28a2VG1xqanGCg==\",\"IDCARD_NO\":\"HcA9l4sL98gwWpaQbahlHX7XSQYh1fEQLy3QIEc7+ms=\",\"USER_TYPE\":\"00\",\"IDCARD_TYPE\":\"01\",\"SIGN\":\"VVPadH0eBtNvV8Lsd3ix6l2b2ma4NAEDJda9kURg3Y4UuQsibMQRP4HvFmFjXDrBem227ep9jx2QaTPSPFakqlQpeeBZXWaan3BJjPdkdGS5vwHgQhrOei5e0433P+dBiVb91Dgcuqt1c/ZvToPWNrVgOSWMy7Of7+6hbc3EsmPELCfv9rwe/hilkW1EryJxbV/AncgmyeUr7RAYCdY8yzXtkpqkQM94HoGIr0GSrRhcU2APJY/RY85eUW6NC6yN7fwR+mgnlHc8CFcJSiFmjWz/HgwoteaJKAZZC+PcUuBIWw4Kbu7X4dYx/J7vI2AlKLHeX2pwwC5h8MmGlaCyIw==\",\"OAUTH_METHOD\":\"SHA1\",\"BIRTHDAY\":\"19900101\",\"OAUTH_APPID\":\"f0ec96ad2c3848b5b810e7aadf369e2f\"}";
//        Map<String, String> map = JSONObject.parseObject(jsonString, Map.class);
//        map.put(PARAM_OAUTH_TIMESTAMP, getTime());
//        return map;
//    }
//
//    private static String getTime() {
//        String timeNao = System.currentTimeMillis() + "";
//        String substring = timeNao.substring(0, timeNao.length() - 3);
////        return "1590807553";
//        return substring;
//    }
//
//
//}
